<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0050)http://localhost:8080/HouseRent/manage!list.action -->
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<TITLE>云和租房 - 用户管理</TITLE>
<style type="text/css">     
    .mask {       
            position: absolute; top: 0px; filter: alpha(opacity=60); background-color: #777;     
            z-index: 1002; left: 0px;     
            opacity:0.5; -moz-opacity:0.5;     
        }     
</style>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<LINK rel=stylesheet type=text/css href="../css/style.css">
<META name=GENERATOR>
<script type="text/javascript" src="/jquery/jquery-1.8.3.js"></script>
</HEAD>
<BODY>
	<DIV id=header class=wrap>
		<DIV id=logo>
			<IMG src="../images/logo.gif">
		</DIV>
		<DIV class=search>
			<LABEL class="ui-green searchs"><a href="fabu.jsp" title="">发布房屋信息</a></LABEL>
			<LABEL class=ui-green><INPUT
				onclick='document.location="index.jsp"' value="退       出"
				type=button name=search></LABEL>
		</DIV>
	</DIV>
	<DIV class="main wrap">
		<DIV id=houseArea>
			<TABLE class=house-list>
				<TBODY id="tbody">
			
<script>
//删除住房信息
function shanchu(val) {
	if(confirm("确定要删除吗？")){
		$(function () {
			 $.ajax({
				type : "POST",
				url : "/json/query_delHouse",
				data : {
					"id" : val,
				},success : function(data) {
					init($("#pageIndex").html());			
				},
				error:function(){
					alert("删除失败");
				}
			}); 
		})
	}
	
}
//修改住房
function update(val) {
	alert(val);
	window.location.href = "queryHouse!queryHouse.action?houseid="+val;
}
//页面初始化
init('1');
function init(val) {
	$(function() {
		$.ajax({
			type : "POST",
			url : "/json/getAllHouse",
			data : {
				"pageIndex" : val,
			},
			success : function(data) {
				var $suggest="";
				$.each(data.houseList,function(i, val) {
					
					$suggest+="<TR><TD class=house-thumb><SPAN>"; 
					$suggest+="<A href='getHouse!getHouseById.action?id="+val.houseid+"' target='_blank'>"; 
					$suggest+="<img src='/images/"+val.pic+"' width='100' height='75' alt='' >"; 
					$suggest+="</A></SPAN></TD><TD><DL>"; 
					$suggest+="<DT><A href='getHouse!getHouseById.action?id="+val.houseid+"' target='_blank' >"+val.title+"</A></DT>"; 
					$suggest+="<DD>"+val.street.area.areaname+val.street.streetname+","+val.floorage+"平米<BR>联系方式："+val.contact+"</DD></DL></TD>"; 
					$suggest+="<TD class=house-type><LABEL class=ui-green>"; 
					$suggest+="<INPUT onclick='update("+val.houseid+")' value='修    改' type=button name=search></LABEL></TD>"; 
					$suggest+="<TD class=house-price>"; 
					$suggest+="<LABEL class=ui-green><INPUT value='删    除' type=button onclick='shanchu("+val.houseid+")'>"; 
					$suggest+="</LABEL></TD></TR>"; 
					
				});
				$("#tbody").html($suggest);
				var $str = "";
				for (var i = 1; i <= data.totalPage; i++) {
					$str += "<LI class=current><A id=widget_338868862 href='#' onclick='tiaozhuan("+i+")'";
					$str += "parseContent='true' showError='true' targets='houseArea' ajaxAfterValidation='false'";
					$str += "validate='false' dojoType='struts:BindAnchor'>"+i+"</A></LI>";
				}
				$("#page").html($str);
				$("#pageIndex").html(data.currPage);
				$("#totalPage").html(data.totalPage);
			}
		});
	});
}
//页面跳转
function tiaozhuan(val){
	init(val);
}


</script>
				
				</TBODY>
			</TABLE>
		</DIV>
		<DIV class=pager>
			<UL id="page">
			
			</UL>
			<SPAN class=total><span id="pageIndex"></span>/<span id="totalPage"></span>页</SPAN>
		</DIV>
	</DIV>
	<DIV id=footer class=wrap>
		<DL>
			<DT>云和租房 © 2010 云和 京ICP证1000001号</DT>
			<DD>关于我们 · 联系方式 · 意见反馈 · 帮助中心</DD>
		</DL>
	</DIV>
</BODY>
</HTML>
